package com.zxm.ex.film.controller;

import com.zxm.ex.common.exception.BackendException;
import com.zxm.ex.common.vo.BaseResultVo;
import com.zxm.ex.common.vo.FilmPage;
import com.zxm.ex.common.vo.PageResultVo;
import com.zxm.ex.film.controller.vo.FilmVo;
import com.zxm.ex.film.service.IFilmService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/films")
public class FilmController {

    @Autowired
    private IFilmService iFilmService;

    /**
     * 演员列表查询
     * @return
     * @throws BackendException
     */
    @RequestMapping("/actors")
    public BaseResultVo getFilmsList(FilmPage filmPage) throws BackendException {
        PageResultVo pageResultVo=iFilmService.getFilmsList(filmPage);
        return BaseResultVo.success(pageResultVo);
    }
    /**
     * 根据电影编号查询电影信息接口
     * @return
     * @throws BackendException
     */
    @RequestMapping("/{filmId}")
    public BaseResultVo getFilmById(@PathVariable("filmId") String filmId) throws BackendException {
        FilmVo filmVo=iFilmService.getFilmById(filmId);
        return BaseResultVo.success(filmVo);
    }
}
